#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>

int main(void) {
	char * username;
	char * semester[] = { "Spring", "Summer", "Fall" };
	int courses, cursem;
	time_t temp;
	struct tm* curtime;

printf("\nEnter the number of courses you are taking this semester.\n");
if(!scanf("%d", &courses)) {
	printf("\nERROR: Invalid input.\n");
	exit(EXIT_FAILURE);
}

username = getlogin();
if(username == NULL) {
	printf("\nERROR: Problem with retrieving your username.\n");
	exit(EXIT_FAILURE);
}


time( &temp );
curtime = localtime( &temp );

if(curtime->tm_mon <5) { cursem = 0; }

if((curtime->tm_mon >= 5) && (curtime->tm_mon <= 7)) { cursem = 1; }

if((curtime->tm_mon >= 8) && (curtime->tm_mon <= 11)) { cursem = 2; }

printf("Hello %s.  It is currently %s %d and you are enrolled in %d units.\n", username, semester[cursem], (curtime->tm_year + 1900), courses);

return(EXIT_SUCCESS);
}
